<template>
  <div class="memeber-home">
    <!-- 预览组件 -->
    <HomeOverview></HomeOverview>
    <!-- 面板组件 -->
    <!-- 收藏 -->
    <HomePanel title="我的收藏">
      <GoodsItem v-for="item in collectGoods" :key="item.id" :goods="item"></GoodsItem>
    </HomePanel>
    <!-- 足迹 -->
    <HomePanel title="我的足迹">
      <GoodsItem v-for="item in collectGoods" :key="item.id" :goods="item"></GoodsItem>
    </HomePanel>
    <!-- 猜你喜欢 -->
    <GoodsRelevant></GoodsRelevant>
  </div>
</template>

<script>
import HomeOverview from './components/home-overview'
import GoodsRelevant from '@/views/goods/components/goods-relevant.vue'
import HomePanel from './components/home-panel.vue'
import GoodsItem from '@/views/category/components/goods-item.vue'
import { findCollectGoods } from '@/api/member'
import { ref } from '@vue/reactivity'

export default {
  name: 'MemberHome',
  components: { HomeOverview, GoodsRelevant, HomePanel, GoodsItem },
  setup () {
    const collectGoods = ref([])
    // 调用模拟的接口
    findCollectGoods({
      page: 1,
      pageSize: 4
    }).then(data => {
      // console.log(data)
      collectGoods.value = data.result.items
      // console.log(collectGoods.value)
    })
    return { collectGoods }
  }
}
</script>

<style lang="less" scoped>
:deep(.xtx-carousel) .carousel-btn.prev {
  left: 5px;
}
:deep(.xtx-carousel) .carousel-btn.next {
  right: 5px;
}
</style>
